package lab02.test19;

import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);


        System.out.println("请输入字符串：");
        String string = sc.nextLine();

        /*创建一个与字符串等长度的字符数组*/
        char[] tem = new char[string.length()];

        /*实现大小写的转换*/
        for (int i = 0; i < string.length(); i++) {
            tem[i] = string.charAt(i);

            if (tem[i] >= 'A' && tem[i] <= 'Z') {
                //将大写转换为小写
                tem[i]=(char)(tem[i]+32);
            }
            else if (tem[i] >= 'a' && tem[i] <= 'z') {
                //将小写转换为大写
                tem[i]=(char)(tem[i]-32);
            }
        }

        /*倒序输出*/
        for (int i = string.length()-1;i>=0;i--){
            System.out.print(tem[i]);
        }


    }
}
